<?php
	include_once('./db/config.php');
	include_once('./model/Country.php');
	
	function getAllCountries()
	{	
		$countries = false;
		try
		{
			connectDb("tictocwatches");
			global $dbLink;
			$queryString = "call sp_getCountries()";
			$resultPointer = mysqli_query($dbLink,$queryString);
			
			if($resultPointer)
			{
				$countries = array();
				while($resultRow = mysqli_fetch_assoc($resultPointer))
				{
					array_push($countries, $resultRow);
				}
				return $countries;				
			}
			else
			{
				$queryError = mysqli_errno($dbLink);
				if($queryError!=0)
				{
					print_r($queryError);
				}
			}
		}
		catch(Exception $ex)
		{
			throw new Exception($ex->getMessage());
		}	
		return $countries;
	}

?>
